/*-//GEN-BEGIN:copyright
 * ForBILE - Framework for Building Interactive Learning Environments
 * Computing Institute - Federal University of Alagoas - Brazil
 * Group of Otimization of the Web
 *
 * Copyright (C) 2007 Ig Bittencourt (ig.ibert@gmail.com)
 *		      Camila Nunes (camilapbnunes@hotmail.com)
 *	              Marcos Tadeu (zero.ufal@gmail.com)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *///GEN-END:copyright
package br.ufal.ic.forbile.agents.persistence;

import br.ufal.ic.forbile.agents.persistence.behaviours.CreateOWL;
import br.ufal.ic.forbile.agents.persistence.behaviours.DeleteOWL;
import br.ufal.ic.forbile.agents.persistence.behaviours.RetrieveOWL;
import br.ufal.ic.forbile.agents.persistence.behaviours.UpdateOWL;
import br.ufal.ic.forbile.exceptions.PersistenceServiceException;
import br.ufal.ic.forbile.infra.GenericKAO;
import br.ufal.ic.forbile.infra.interaction.ontology.Agent;
import jade.core.AID;
import java.util.logging.Logger;

/**
 * PersistenceOWLAgentInteraction1.java
 *
 * <p>A full description of this class.
 *
 * @see PersistenceAgent.
 *
 * @author <a href="mailto:ig.ibert@gmail.com">ig</a>.
 * @since 0.1
 * @version 0.1
 *
 */
public class PersistenceOWLAgentInteraction extends PersistenceAgent {
    
    // Constants -----------------------------------------------------
    
    // Attributes ----------------------------------------------------
    
    // Static --------------------------------------------------------
    
    private static Logger logger;
    
    static {
        logger = Logger.getLogger(PersistenceOWLAgentInteraction.class.getName());
    }
    
    // Constructors --------------------------------------------------
    
    /**
     * Creates a new instance of PersistenceOWLAgentInteraction1
     * @param containerName the jade container name
     * @param agentLocalName the agent local name
     */
    public PersistenceOWLAgentInteraction(final String containerName, final String agentLocalName) {
        super(containerName, agentLocalName);
        GenericKAO kao = new GenericKAO("interaction");
        try {
            Agent interactionAgent = (Agent) kao.retrieve
                    ("PersistenceOWLAgentInteraction", "Agent");
            super.configureInteraction(interactionAgent);
        } catch (Exception ex) {
            new PersistenceServiceException(ex);
        }
    }
    
    // Public --------------------------------------------------------
    
    /**
     * Retrieves the specific content
     * @param receiver the receiver AID agent
     */
    public void retrieve(final AID receiver) {
        addBehaviour(new RetrieveOWL(super.getPersistenceOWLLog(), receiver));
    }
    
    /**
     * Updates the specific content
     */
    public void update(final AID receiver) {
        addBehaviour(new UpdateOWL(super.getPersistenceOWLLog(), receiver));
    }
    
    /**
     * Deletes the specific content
     */
    public void delete(final AID receiver) {
        addBehaviour(new DeleteOWL(super.getPersistenceOWLLog(), receiver));
    }
    
    /**
     * Creates the specific content
     */
    public void create(final AID receiver) {
        addBehaviour(new CreateOWL(super.getPersistenceOWLLog(), receiver));
    }
    
    // Z implementation ----------------------------------------------
    
    // Y overrides ---------------------------------------------------
    
    // Package protected ---------------------------------------------
    
    // Protected -----------------------------------------------------
    
    // Private -------------------------------------------------------
    
    // Inner classes -------------------------------------------------
    
}
